﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using PloobsEngine.Utils;
using PloobsEngine.Modelo.Animation;
using PloobsEngine.Modelo;
using PloobsEngine.SceneControl;
using PloobsEngine.Light;
using LTreesLibrary.Trees.Wind;
using LTreesLibrary.Trees;


namespace PloobsEngine.Material
{
    public class TreeMaterial : Material
    {        
        private TreeWindAnimator animator;
        static private WindStrengthSin wind = new WindStrengthSin();

        /// <summary>
        /// Serialization
        /// </summary>
        public TreeMaterial()
        {
            
        }

        public TreeMaterial(TreeShader shader) :
            base(shader,MaterialType.DEFERRED)
        {
            this.animator = new TreeWindAnimator(wind);            
        }

        public override void  Update(Microsoft.Xna.Framework.GameTime gametime, IObject obj, IList<ILight> lights)
        {
            wind.Update(gametime);
            SimpleTree tree = (obj.Modelo as TreeModel).Tree;
            animator.Animate(tree.Skeleton, tree.AnimationState, gametime);
            base.Update(gametime, obj,lights);
            
        }
        

    }
}
